// linux操作系统执行命令的方式
package main
import (
	"fmt"
	"os/exec"
)
func Cmd(cmd string, shell bool) []byte {
	if shell {
		out, err := exec.Command("bash", "-c", cmd).Output()
		if err != nil {
			panic("some error found")
		}
		return out
	} else {
		out, err := exec.Command(cmd).Output()
		if err != nil {
			panic("some error found")
		}
		return out
	}
}
func main() {
	//cmd := "ls -al"
	cmd := "python test.py"
	//cmd := "python -V" //没有输出
	//cmd := "env"
	out := string(Cmd(cmd,true))
	//out := string(Cmd(cmd,false))
	fmt.Println(out)
}